package com.tinywind.admin.common.base;

import com.tinywind.admin.common.config.shiro.ShiroUtils;
import com.tinywind.admin.module.system.entity.SysUserInfo;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * @author liuxingyu01
 * @date 2021-12-23-13:03
 * @description 基础控制器
 **/
public abstract class BaseController {
    private static final Logger logger = LoggerFactory.getLogger(BaseController.class);
    public static final String RESULT_ROWS = "rows";
    public static final String RESULT_TOTAL = "total";

    public BaseController() {
    }


    /**
     * 获取登录用户
     *
     * @return
     */
    public SysUserInfo getSysUserInfo() {
        return ShiroUtils.getSysUserInfo();
    }

    /**
     * 获取登录用户ID
     *
     * @return
     */
    public String getSysUserId() {
        return ShiroUtils.getSysUserId();
    }

    /**
     * 获取登录用户账户account
     *
     * @return
     */
    public String getSysUserAccount() {
        return ShiroUtils.getSysUserAccount();
    }

    /**
     * 获取用户token
     * @return
     */
    public String getSessionId() {
        return ShiroUtils.getSessionId();
    }
}
